package com.mallcloud.mall.common.core.constant.enums.mall;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.util.Arrays;

/**
 *
 */
@Getter
@AllArgsConstructor
public enum MallCommonEnum {

	DEMO("DEMO", "字典"),
	;

	private final String type;
	private final String description;

	@Getter
	@RequiredArgsConstructor
	public enum StatusEnum {
		Y(1, "Y", "可用"),
		N(0, "N", "禁用"),
		;
		private final Integer code;
		private final String eCode;
		private final String description;

		public static String getDecs(String code) {
			return Arrays.stream(values()).filter(x -> x.getECode().equals(code)).findFirst().get().getDescription();
		}
		public static String getDecs(Integer code) {
			return Arrays.stream(values()).filter(x -> x.getCode().equals(code)).findFirst().get().getDescription();
		}

	}

	@Getter
	@RequiredArgsConstructor
	public enum StatusWithDelEnum {
		Y(1, "Y", "可用"),
		N(0, "N", "禁用"),
		D(-1, "D", "删除"),
		;
		private final Integer code;
		private final String eCode;
		private final String description;

		public static String getDecs(String code) {
			return Arrays.stream(values()).filter(x -> x.getECode().equals(code)).findFirst().get().getDescription();
		}
		public static String getDecs(Integer code) {
			return Arrays.stream(values()).filter(x -> x.getCode().equals(code)).findFirst().get().getDescription();
		}

	}
}
